package com.home.homepage.controller.postFooter;

import com.eig.common.entity.homepageentity.postFooter.TbBottomArticle;
import com.eig.common.vo.Result;
import com.home.homepage.service.postFooter.FooterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：YQ袁（2446806940@qq.com）
 * @date ：Created in 2022/12/9 15:28
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/bottomarticle")
@Api(value = "文章管理")
public class FooterController {
    @Autowired
    private FooterService footerService ;


    @PostMapping("/getAllBottomArticle/{current}/{pageSize}")
    @ApiOperation(value = "分页接口")
    public Result getAllBottomArticle(
            @PathVariable Integer current,
            @PathVariable Integer pageSize,
            @RequestBody TbBottomArticle tbBottomArticle
            ){
        return footerService.getAllBottomArticle(current,pageSize,tbBottomArticle);
    }
    @PostMapping("/addBottomArticle")
    @ApiOperation(value = "添加和修改")
    public Result addBottomArticle( @RequestBody TbBottomArticle tbBottomArticle){
        return footerService.addBottomArticle(tbBottomArticle);
    }
    @PostMapping("/changeStatus/{id}/{isDisable}")
    @ApiOperation(value = "修改状态")
    public Result changeStatus (
            @PathVariable String id,
            @PathVariable String isDisable
    ){
        return footerService.changeStatus(id ,isDisable);
    }
    @PostMapping("/deleteBottomArticle")
    @ApiOperation(value = "删除")
    public Result deleteBottomArticle(@RequestBody TbBottomArticle tbBottomArticle){
        return footerService.deleteBottomArticle(tbBottomArticle);
    }
}
